<template>
	<view class="texts">
		<view class="info" v-html="htmlNodes"></view>
	</view>
</template>

<script>
	import htmlParser from '@/common/html-parser'
	export default {
		data() {
			return {
				htmlNodes: []
			}
		},
		async onLoad(options){
			let id=options.id;
			uni.showLoading({
				title: 'loading'
			});
			var that=this;
			this.$api.ajax('index/article', {
				id:id
			}, function(res) {
				uni.hideLoading();
				var data = res[1].data;
				if (data.statusCode == 200) { 
					var htmlString = data.data.content.replace(/\\/g, "").replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
					//that.htmlNodes = htmlParser(htmlString);
					that.htmlNodes = htmlString;
					uni.setNavigationBarTitle({
						title: data.data.title
					})
				} else {
					that.$api.msg('网络失败');
				}
			});
			
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #ffffff;
	}
	.info{
		padding:15px;
		line-height: 26px;
		img{
			max-width: 100%;
		}
	}
	.texts{
		img{
			max-width: 100% !important;
		}
	}
</style>
